import java.io.*;

public class FileCopy_plus_plus {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("MyFile\\src\\tmp\\bw.txt"));
        BufferedWriter bw = new BufferedWriter(new FileWriter("MyFile\\src\\tmp\\bw_copy.txt"));

        /*
        char[] chs = new char[1024];
        int len;
        while((len = br.read(chs)) != -1){
            bw.write(chs,0,len);
        }
        br.close();
        bw.close();
        */


   //试用字符流特有功能实现复制
        String line;
        while((line = br.readLine()) != null){   // br.readline() : 读取一行数据，不读取终止符和和换行符
            bw.write(line);
            bw.newLine();                        // 写入换行符
            bw.flush();                          //刷新流
        }

    }
}
